<?php

use App\Admin\Controllers\DemoController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'     => config('admin.route.prefix'),
    'namespace'  => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');
    Route::prefix('demo')->group(function () {
        Route::get(null, [DemoController::class, 'index'])->name('demo.index');
        Route::get('create', [DemoController::class, 'create'])->name('demo.create');
        Route::get('{id}/edit', [DemoController::class, 'edit'])->name('demo.edit')->whereNumber('id');
        Route::post(null, [DemoController::class, 'store'])->name('demo.store');
        Route::put('{id}', [DemoController::class, 'update'])->name('demo.update')->whereNumber('id');
        Route::get('{id}', [DemoController::class, 'detail'])->name('demo.detail')->whereNumber('id');
    });
});
